package com.songlanyun.modules.returnaddress.controller.admin;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.songlanyun.common.annotation.SysLog;
import com.songlanyun.modules.returnaddress.model.dto.ReturnAddressDTO;
import com.songlanyun.modules.user.controller.AbstractController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.songlanyun.modules.returnaddress.entity.ReturnAddress;
import com.songlanyun.modules.returnaddress.service.ReturnAddressService;
import com.songlanyun.common.utils.PageUtils;
import com.songlanyun.common.utils.R;



/**
 * 商家收货地址
 *
 * @author lubo
 * @email sunlightcs@gmail.com
 * @date 2020-11-11 13:39:14
 */
@RestController
@RequestMapping("admin/returnaddress")
public class ReturnAddressAdminController extends AbstractController {
    @Autowired
    private ReturnAddressService returnAddressService;



    /**
     * 商家获取自家店铺的收货地址
     */
    @RequestMapping("/info")
    //@RequiresPermissions("returnaddress:shopreturnaddress:info")
    public R info(){
		ReturnAddress shopReturnAddress = returnAddressService.getReturnAddress(getShopId());
        return R.ok().put("data", shopReturnAddress);
    }

    /**
     * 商家设置自家店铺的收货地址
     */
    @SysLog("商家设置自家店铺的收货地址")
    @PostMapping("/save")
    //@RequiresPermissions("returnaddress:shopreturnaddress:save")
    public R save(@RequestBody ReturnAddressDTO dto){
        ReturnAddress data = returnAddressService.set(getShopId(), dto);
        return R.ok().put("data",data);
    }


}
